<%--
 *  File:    InvoPerspectiveReport.jsp
 *  @Author: gengan
 *  Date:    2011/11/10
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.InvoPerspectiveReport"); 

  //init param
  String strModuleName = "CM";
  String privilegeCode = "R60030";
  String contextPath = request.getContextPath();
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>InvoPerspectiveReport</title>
<PageFlow:CheckPageFlow pageName="p_nationalsalesreport"/>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>
<script>

 function page_go(){
	var dtlevel1 = cform.dtlevel1.options[cform.dtlevel1.selectedIndex].innerText;
	var areacodestr = cform.bigzoneid.options[cform.bigzoneid.selectedIndex].innerText;
	if(areacodestr=="ALL")areacodestr=null;
	var prodname = cform.prodname.value;
	var url =  "<%= reportURL%>" + "/frameset?__report=/ovalreport/Tdr_OriPosDataReport.rptdesign&sessionid=<%=session.getId()%>&year=" 
			+ cform.year.value + "&month=" + cform.month.value + "&dtlevel=" + escape(encodeURI(dtlevel1));
	if(!isEmpty(areacodestr)) url += "&areacodestr=" + escape(encodeURI(areacodestr));
	if(!isEmpty(prodname)) url += "&prodname=" +escape(encodeURI(prodname));
	document.iframe.location.href = url;
	
 }
 var popwindow;
 function page_selectProd() {
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath%>/phap/phap.datp/masterdata/kdm/ProductSelect.jsp?o_thread=" + Math.random();
			
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow", status);
	}
function page_setproduct(id,umcode,prodcode,prodname){
		document.cform.prodid.value=id;
		document.cform.prodname.value=prodname;
	}
</script>
</head>
<body >
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_nationalsalesreport">
	<input type="hidden" name="actionname">

   <tr>
    <td> 
      <table width="100%" border="0" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center" 
style="background:url(<%= contextPath %>/images/<%= strLanguageCode %>/title_2_bg.jpg) repeat-x; " height="36">  
         <tr >
         <% 
         String flag = (String)pageContext.getAttribute("flag");
					java.util.Calendar cal = java.util.Calendar.getInstance();      
					String year = cal.get(Calendar.YEAR)+"";     
					String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  
					if("first".equals(flag)){ 
				%>
        <td width="20%" class="td_right">&nbsp;</td>
          	<td class="td_right" width="5%"><%= label.getLabelName("L_Year")%><font color="red">*</font>：</td>
            <td width="5%">
            	<custom:selectdic property="year" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/>
            </td>
         	<td class="td_right" width="5%"><%= label.getLabelName("L_Month")%><font color="red">*</font>：</td>
          	<td width="5%">
            	<custom:selectdic property="month" dictType="Months" command="notnull" value="<%=month %>" label="L_Month"/>
            </td>
      <%}else{ %>
      <td class="td_right" width="5%"><%= label.getLabelName("L_Year")%><font color="red">*</font>：</td>
            <td width="5%">
            	<custom:selectdic property="year" dictType="Years" command="notnull" label="L_Year1"/>
            </td>
         	<td class="td_right" width="5%"><%= label.getLabelName("L_Month")%><font color="red">*</font>：</td>
          	<td width="5%">
            	<custom:selectdic property="month" dictType="Months" command="notnull" label="L_Month"/>
            </td>
            <%} %>
      
         	<td class="td_right" width="5%"><%= label.getLabelName("L_Businessarea") + label.getLabelName("L_Colon") %></td>
            <td width="5%"><custom:select optionInnerTextKey="areaname" optionsName="areas" optionValueKey="areaid" property="bigzoneid" defaultValue="ALL" defaultValueCost="" /></td>
         	<td class="td_right" width="8%"><%= label.getLabelName("L_DealersLevel")%> <font color="red">*</font>：</td>
         	<td width="8%"><custom:selectdic dictType="DealersLevel" property="dtlevel1"/></td>
         	<td width="2%" class="td_right">&nbsp;</td>
         	<td class="td_right" width="8%"><%= label.getLabelName("L_ProdName") + label.getLabelName("L_Colon") %></td>
         	<td class="td_center" width="14%">
         		<custom:text property="prodname" readonly="false" size="22"/>
         		<a onclick="javascript:page_selectProd();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	            <custom:hidden property="prodid" /></td>
         	<td width="2%" class="td_right">&nbsp;</td>
         	<td><a href="javascript:page_go()"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a></td>
         <td width="*%" class="td_right">&nbsp;</td>
         </tr>
       </table>
    </td>
  </tr>
  </form>
</table>
<iframe src="<%= contextPath %>/Blank.jsp" frameborder=0 width="100%" height="85%" name="iframe"></iframe>
</body>
</html>